<%@ page language="java"
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="com.shxt.hotel.background.User"
         import="java.util.List"
         import="java.util.Map"
%>
<%
    User user = new User();
    if(session.getAttribute("id") == null){
        response.sendRedirect("./login.jsp");
    }else{
        int uid = (int)session.getAttribute("id");
        Map<String, Object> currentUser = user.getUserInfo(uid);
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <link rel="shortcut icon" href="../Public/img/favicon.html">

    <title>VIP Purchase</title>

    <!-- Bootstrap core CSS -->
    <link href="../Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="../Public/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="../Public/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="../Public/css/style.css" rel="stylesheet">
    <link href="../Public/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="../Public/js/html5shiv.js"></script>
      <script src="../Public/js/respond.min.js"></script>
    <![endif]-->
    <style>
        * {
            font-family: '微软雅黑';
        }
    </style>
</head>

<body>

    <section id="container" class="">
        <!--header start-->
        <jsp:include page="./Public/header.jsp" flush="true" />
        <!--header end-->
        <!--sidebar start-->
        <jsp:include page="./Public/sidebar.jsp" flush="true" />
        <!--sidebar end-->
        <!--main content start-->
        <section id="main-content">
            <section class="wrapper">
                <div class="row">
                    <div class="col-lg-8 col-md-offset-2">
                        <!--latest product info start-->
                        <%
                            List<Map<String, Object>> userPermList = user.getPermissionList();
                            for(Map<String, Object> userPerm : userPermList){
                                if((int)userPerm.get("id") == 0){
                                    continue;
                                }else{
                        %>
                        <section class="panel post-wrap pro-box">
                            <aside>
                                <div class="post-info">
                                    <span class="arrow-pro right"></span>
                                    <div class="panel-body">
                                        <h1><strong><%=userPerm.get("title") %></strong> <br> Price: $ <%=userPerm.get("price") %></h1>
                                        <div class="desk yellow">
                                            <h3>Discount</h3>
                                            <p>
                                                Room Discount: - <%=userPerm.get("room_discount") %>%<br>
                                                Consume Discount: - <%=userPerm.get("consume_discount") %>%
                                            </p>
                                        </div>
                                        <div class="post-btn">
                                            <%
                                                Boolean is_purchase = (int)currentUser.get("user_permission") == (int)userPerm.get("id");
                                                String ahref = is_purchase ? "#" : "./background/hotel_vip_purchase_do.jsp?uid=" + uid + "&pid=" + userPerm.get("id");
                                            %>
                                            <a href='<%=ahref %>'>
                                                <button type="button" class="btn btn-sm btn-info" <%=is_purchase == true ? "disabled" : "" %>>Purchase</button>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </aside>
                            <aside class="post-highlight yellow v-align">
                                <div class="panel-body text-center">
                                    <div class="pro-thumb">
                                        <img src="../Public/img/ring.jpg" alt="">
                                    </div>
                                </div>
                            </aside>
                        </section>
                        <%
                                }
                            }
                        %>
                        <!--latest product info end-->
                        <!--twitter feedback start-->
                        <!--<section class="panel post-wrap pro-box">
                            <aside class="post-highlight terques v-align">
                                <div class="panel-body">
                                    <h2>Flatlab is new model of admin dashboard <a href="../Public/javascript:;"> http://demo.com/</a> 4 days ago  by jonathan smith</h2>
                                </div>
                            </aside>
                            <aside>
                                <div class="post-info">
                                    <span class="arrow-pro left"></span>
                                    <div class="panel-body">
                                        <div class="text-center twite">
                                            <h1>Twitter Feed</h1>
                                        </div>

                                        <footer class="social-footer">
                                            <ul>
                                                <li>
                                                    <a href="../Public/#">
                                                        <i class="icon-facebook"></i>
                                                    </a>
                                                </li>
                                                <li class="active">
                                                    <a href="../Public/#">
                                                        <i class="icon-twitter"></i>
                                                    </a>
                                                </li>
                                                <li>
                                                    <a href="../Public/#">
                                                        <i class="icon-google-plus"></i>
                                                    </a>
                                                </li>
                                                <li>
                                                    <a href="../Public/#">
                                                        <i class="icon-pinterest"></i>
                                                    </a>
                                                </li>
                                            </ul>
                                        </footer>
                                    </div>
                                </div>
                            </aside>
                        </section>-->
                        <!--twitter feedback end-->
                    </div>
                </div>

            </section>
        </section>
        <!--main content end-->
    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="../Public/js/jquery.js"></script>
    <script src="../Public/js/jquery-1.8.3.min.js"></script>
    <script src="../Public/js/bootstrap.min.js"></script>
    <script src="../Public/js/jquery.scrollTo.min.js"></script>
    <script src="../Public/js/jquery.nicescroll.js" type="text/javascript"></script>

    <!--common script for all pages-->
    <script src="../Public/js/common-scripts.js"></script>

    <script>
        //owl carousel

      $(document).ready(function() {
          
          $("#Hotel_Service").addClass("active");
          $("#hotel_vip_purchase").addClass("active")
          
          $("#owl-demo").owlCarousel({
              navigation : true,
              slideSpeed : 300,
              paginationSpeed : 400,
              singleItem : true

          });
      });

      //custom select box

      $(function(){
          $('select.styled').customSelect();
      });
    </script>
    
    <!--scripted by myself-->
    <script>
        $(document).ready(function(){
            $("#Hotel_Service").addClass("active");
            $("#hotel_vip_purchase").addClass("active");
        });
    </script>

</body>

</html>
<%
    }
%>